package com.itheima.mapper;

import com.itheima.common.Com.AddressBook;
import com.itheima.common.vo.AddressBookDto;
import com.itheima.common.vo.AddressBookVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AddressBookMapper {
    List<AddressBook> list();

    int add(AddressBookVo addressBookVo);

    AddressBookVo findAll(@Param("id") String id);

    AddressBook getById(String id);

    AddressBook getmoren();

    boolean updateMoren(AddressBookDto addressBookDto);


    AddressBookDto findByIsDefault(AddressBookDto addressBookDto);

    @Select("select * from address_book  where `id`=#{id} and `is_default`=1")
    AddressBook find(String id);

    @Select("select * from address_book where `is_default` =1")
    AddressBook find1();
    @Update("update address_book set `is_default`=0")
    boolean set();

    boolean updateById(@Param("addressBook") AddressBook addressBook);

    boolean delete(String ids);
}
